|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
WSDLGenerator.java | 50% | 83.3% | 100% | 80% |
|
1 |
/*
|
|
2 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
|
|
17 |
package org.apache.geronimo.ews.ws4j2ee.toWs.wsdl;
|
|
18 |
|
|
19 |
import org.apache.axis.utils.ClassUtils;
|
|
20 |
import org.apache.axis.wsdl.Java2WSDL;
|
|
21 |
import org.apache.axis.wsdl.fromJava.Emitter;
|
|
22 |
import org.apache.commons.logging.Log;
|
|
23 |
import org.apache.commons.logging.LogFactory;
|
|
24 |
import org.apache.geronimo.ews.ws4j2ee.context.ContextValidator;
|
|
25 |
import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
|
|
26 |
import org.apache.geronimo.ews.ws4j2ee.context.impl.AxisEmitterBasedJaxRpcMapperContext;
|
|
27 |
import org.apache.geronimo.ews.ws4j2ee.context.wsdl.impl.AxisEmitterBasedWSDLContext;
|
|
28 |
import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
|
|
29 |
import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
|
|
30 |
import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeDeployContext;
|
|
31 |
import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
|
|
32 |
|
|
33 |
/**
|
|
34 |
* <p>This genarated theWrapper WS required in the
|
|
35 |
* Axis.</p>
|
|
36 |
*
|
|
37 |
* @author Srinath Perera(hemapani@opensource.lk)
|
|
38 |
*/
|
|
39 |
public class WSDLGenerator extends Java2WSDL implements Generator { |
|
40 |
private J2EEWebServiceContext wscontext;
|
|
41 |
private Ws4J2eeDeployContext clparser;
|
|
42 |
private Emitter emitter;
|
|
43 |
private String wsdlFile;
|
|
44 |
private boolean verbose; |
|
45 |
|
|
46 |
protected static Log log = |
|
47 |
LogFactory.getLog(WSDLGenerator.class.getName());
|
|
48 |
|
|
49 | 11 |
public WSDLGenerator(J2EEWebServiceContext wscontext,
|
50 |
Emitter emitter, |
|
51 |
Ws4J2eeDeployContext clparser) throws GenerationFault {
|
|
52 | 11 |
this.wscontext = wscontext;
|
53 | 11 |
this.emitter = emitter;
|
54 | 11 |
this.clparser = clparser;
|
55 | 11 |
this.wsdlFile = wscontext.getMiscInfo().getWsdlFile().fileName();
|
56 |
} |
|
57 |
|
|
58 | 11 |
public void generate() throws GenerationFault { |
59 | 11 |
try {
|
60 | 11 |
if (verbose)
|
61 | 0 |
log.info("calling Java2WSDL to genarated wsdl ...........");
|
62 |
//generate the wsdl file
|
|
63 | 11 |
ClassUtils.setDefaultClassLoader(wscontext.getMiscInfo().getClassloader()); |
64 | 11 |
emitter.setLocationUrl("http://localhost:8080/ws/" + wscontext.getWSCFContext().getWscfport().getPortComponentName());
|
65 | 11 |
emitter.setServicePortName(wscontext.getWSCFContext().getWscfport().getWsdlPort().getLocalpart()); |
66 | 11 |
int mode = Emitter.MODE_ALL;
|
67 | 11 |
mode = clparser.getMode(); |
68 |
|
|
69 |
// Find the class using the name
|
|
70 | 11 |
String seiName = wscontext.getMiscInfo().getJaxrpcSEI(); |
71 | 11 |
emitter.setCls(seiName); |
72 |
// Generate a full wsdl, or interface & implementation wsdls
|
|
73 | 11 |
Utils.prepareTheDir(wsdlFile); |
74 | 11 |
if (wsdlImplFilename == null) { |
75 | 11 |
emitter.emit(wsdlFile, mode); |
76 |
} else {
|
|
77 | 0 |
emitter.emit(wsdlFile, wsdlImplFilename); |
78 |
} |
|
79 |
// //initiate the wsdlContext
|
|
80 | 11 |
this.wscontext.setWSDLContext(new AxisEmitterBasedWSDLContext(emitter.getWSDL())); |
81 |
//parse the ejb-jar.xml here
|
|
82 | 11 |
ContextValidator validator = new ContextValidator(wscontext);
|
83 |
//initiate the jaxrpcmapping context
|
|
84 | 11 |
this.wscontext.setJAXRPCMappingContext(new AxisEmitterBasedJaxRpcMapperContext(emitter, wscontext)); |
85 |
// //initiate the wscf context
|
|
86 |
// this.wscontext.setWSCFContext( new AxisEmitterBasedWSCFContext(emitter, wscontext));
|
|
87 |
//validate the j2ee context
|
|
88 | 11 |
validator.validateWithOutWSDL(emitter); |
89 |
} catch (Exception e) {
|
|
90 | 0 |
log.error(e); |
91 | 0 |
throw GenerationFault.createGenerationFault(e);
|
92 |
} |
|
93 |
} |
|
94 |
} |
|
95 |
|
|